#pragma once

#include "..\CfgParsers.h"

#include <HybridRenderer\File\ShaderLoader.h>
#include <HybridRenderer\File\TextureLoader.h>
#include <HybridRenderer\File\MaterialLoader.h>

#include <HybridRenderer\Render\GBuffer.h>
#include <HybridRenderer\Render\DeferredRender.h>

#include <HybridRenderer\Scene\SceneManager.h>
#include <HybridRenderer\Scene\SceneNode.h>
#include <HybridRenderer\Scene\Camera.h>

#include <memory>
#include <string>

namespace Kernel
{
	class Manager;
	typedef std::shared_ptr<Manager> ManagerPtr;

	class Manager
	{
	public:
		static ManagerPtr getSingleton();
		~Manager();

		int configure(const std::string &base_dir);
		int initialize(int argc, char **argv);

		void input(unsigned char key, int x, int y);
		void update(float dt);
		void render();
		

		unsigned int getWidth() const { return engine_data.width; }
		unsigned int getHeight() const { return engine_data.height; }
		float getNearClip() const { return engine_data.near_clip; }
		float getFarClip() const { return engine_data.far_clip; }

	protected:
		friend class std::_Ref_count_obj<Manager>;
		Manager();
		static ManagerPtr singleton;

		std::string base_dir;
		
		TCODParserPtr parser;
		CfgParsers::Engine::ParseData engine_data;

		File::ShaderLoaderPtr shader_loader;
		File::TextureLoaderPtr tex_loader;
		File::MaterialLoaderPtr mat_loader;

		Render::GBufferPtr g_buffer;
		Render::DeferredRenderPtr renderer;

		Scene::SceneManagerPtr scene;
		Scene::CameraPtr camera;
	};
}
